Optimal. Leaf size=91 \[ \frac {(c+i d) (3 d+i c)}{4 a^2 f (1+i \tan (e+f x))}+\frac {x (c-i d)^2}{4 a^2}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.15, antiderivative size = 91, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.107, Rules used = {3540, 3526, 8} \[ \frac {(c+i d) (3 d+i c)}{4 a^2 f (1+i \tan (e+f x))}+\frac {x (c-i d)^2}{4 a^2}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3526
Rule 3540
Rubi steps
\begin {align*} \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx &=\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}+\frac {\int \frac {a \left (c^2-2 i c d+d^2\right )-2 i a d^2 \tan (e+f x)}{a+i a \tan (e+f x)} \, dx}{2 a^2}\\ &=\frac {(c+i d) (i c+3 d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}+\frac {(c-i d)^2 \int 1 \, dx}{4 a^2}\\ &=\frac {(c-i d)^2 x}{4 a^2}+\frac {(c+i d) (i c+3 d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 1.31, size = 134, normalized size = 1.47 \[ -\frac {\sec ^2(e+f x) \left (\left (c^2 (1+4 i f x)+2 c d (4 f x+i)+d^2 (-1-4 i f x)\right ) \sin (2 (e+f x))+\left (c^2 (4 f x+i)+c d (-2-8 i f x)-d^2 (4 f x+i)\right ) \cos (2 (e+f x))+4 i \left (c^2+d^2\right )\right )}{16 a^2 f (\tan (e+f x)-i)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.42, size = 80, normalized size = 0.88 \[ \frac {{\left ({\left (4 \, c^{2} - 8 i \, c d - 4 \, d^{2}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{2} - 2 \, c d - i \, d^{2} + {\left (4 i \, c^{2} + 4 i \, d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{16 \, a^{2} f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.69, size = 176, normalized size = 1.93 \[ -\frac {\frac {2 \, {\left (-i \, c^{2} - 2 \, c d + i \, d^{2}\right )} \log \left (-i \, \tan \left (f x + e\right ) + 1\right )}{a^{2}} + \frac {2 \, {\left (i \, c^{2} + 2 \, c d - i \, d^{2}\right )} \log \left (-i \, \tan \left (f x + e\right ) - 1\right )}{a^{2}} + \frac {-3 i \, c^{2} \tan \left (f x + e\right )^{2} - 6 \, c d \tan \left (f x + e\right )^{2} + 3 i \, d^{2} \tan \left (f x + e\right )^{2} - 10 \, c^{2} \tan \left (f x + e\right ) + 20 i \, c d \tan \left (f x + e\right ) - 6 \, d^{2} \tan \left (f x + e\right ) + 11 i \, c^{2} + 6 \, c d + 5 i \, d^{2}}{a^{2} {\left (\tan \left (f x + e\right ) - i\right )}^{2}}}{16 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.22, size = 263, normalized size = 2.89 \[ \frac {\ln \left (\tan \left (f x +e \right )+i\right ) c d}{4 f \,a^{2}}+\frac {i \ln \left (\tan \left (f x +e \right )+i\right ) c^{2}}{8 f \,a^{2}}-\frac {i \ln \left (\tan \left (f x +e \right )+i\right ) d^{2}}{8 f \,a^{2}}-\frac {i c d}{2 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {c^{2}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {3 d^{2}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )}+\frac {c d}{2 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {i c^{2}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}+\frac {i d^{2}}{4 f \,a^{2} \left (\tan \left (f x +e \right )-i\right )^{2}}+\frac {i \ln \left (\tan \left (f x +e \right )-i\right ) d^{2}}{8 f \,a^{2}}-\frac {i \ln \left (\tan \left (f x +e \right )-i\right ) c^{2}}{8 f \,a^{2}}-\frac {\ln \left (\tan \left (f x +e \right )-i\right ) c d}{4 f \,a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 5.24, size = 93, normalized size = 1.02 \[ -\frac {x\,{\left (d+c\,1{}\mathrm {i}\right )}^2}{4\,a^2}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {c\,d}{2\,a^2}+\frac {c^2\,1{}\mathrm {i}}{4\,a^2}+\frac {d^2\,3{}\mathrm {i}}{4\,a^2}\right )+\frac {c^2}{2\,a^2}+\frac {d^2}{2\,a^2}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.48, size = 260, normalized size = 2.86 \[ \begin {cases} \frac {\left (\left (16 i a^{2} c^{2} f e^{4 i e} + 16 i a^{2} d^{2} f e^{4 i e}\right ) e^{- 2 i f x} + \left (4 i a^{2} c^{2} f e^{2 i e} - 8 a^{2} c d f e^{2 i e} - 4 i a^{2} d^{2} f e^{2 i e}\right ) e^{- 4 i f x}\right ) e^{- 6 i e}}{64 a^{4} f^{2}} & \text {for}\: 64 a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {c^{2} - 2 i c d - d^{2}}{4 a^{2}} + \frac {\left (c^{2} e^{4 i e} + 2 c^{2} e^{2 i e} + c^{2} - 2 i c d e^{4 i e} + 2 i c d - d^{2} e^{4 i e} + 2 d^{2} e^{2 i e} - d^{2}\right ) e^{- 4 i e}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} - \frac {x \left (- c^{2} + 2 i c d + d^{2}\right )}{4 a^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________